Skip to content

Conversation

glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented Aug 19, 2025

Modification:

The code generator imports SwiftProtobuf if the file being generated has a dependency on any of the protos bundled by SwiftProtobuf. This can yield unnecessary imports which may warn if used in conjunction with access levels on imports.

The problem is that the grpc generator checks for dependencies on the FileDescriptor which may include messages defined in the same file as a service. If any of those messages depend on a well known type (WKT) then an import will be added even though the code being generated doesn't include message code.

Modifications:

  • Only include a SwiftProtobuf import if an input or output type for an RPC is a bundled proto.
  • Fix a test where a WKT is used in a message but not as an input/output type for an RPC.

Result:

Fewer warnings

Modification:

The code generator imports SwiftProtobuf if the file being generated has
a dependency on any of the protos bundled by SwiftProtobuf. This can
yield unnecessary imports which may warn if used in conjunction with
access levels on imports.

The problem is that the grpc generator checks for dependencies on the
FileDescriptor which may include messages defined in the same file as a
service. If any of those messages depend on a well known type (WKT) then
an import will be added even though the code being generated doesn't
include message code.

Modifications:

- Only include a SwiftProtobuf import if an input or output type for an
  RPC is a bundled proto.
- Fix a test where a WKT is used in a message but not as an input/output
  type for an RPC.

Result:

Fewer warnings
@glbrntt glbrntt added the 🔨 semver/patch No public API change. label Aug 19, 2025
@glbrntt glbrntt enabled auto-merge (squash) August 19, 2025 14:43
@glbrntt glbrntt merged commit 10b648d into grpc:main Aug 19, 2025
33 of 36 checks passed
@glbrntt glbrntt deleted the avoid-warnings-with-wkts branch August 19, 2025 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants